#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#define ll long long
using namespace std;
ll n,L,R;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%lld%lld%lld",&n,&L,&R);
	R=R-n*(L/n);
	if(R>=n) printf("%lld",n-1);
	else printf("%lld",R);
	fclose(stdin);
	fclose(stdout);
	return 0;
 } 
